<template>
  <div class="grid-content bg-purple-light">
    <el-carousel :interval="5000" arrow="always" height="400px">
      <el-carousel-item v-for="item in images" :key="item">
        <img :src="item" alt="图片加载失败"/>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
export default {
  name: 'Carousel',
  data() {
    return {
      images: [
        require('@/assets/img/1.jpg'),
        require('@/assets/img/2.jpg'),
        require('@/assets/img/3.jpeg'),
      ]
    }
  }
}
</script>

<style lang="less" scoped>
.el-carousel__item {
  img {
    width: 100%;
    height: 100%;
  }
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>
